<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>

<body>
</body>
<script>
  // 千分位并保留两位小数
  var str = "123456789.2356".match(/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?/)[0];
  var res = str.replace(/\B(?<!(\.\d+))(?=(\d{3})+\b)/g, ",");
  console.log(res);
</script>

</html>